package com.mvp.lt.airlineview;

import com.amap.api.maps.model.LatLng;
import com.mvp.lt.airlineview.map.MapCalculationLogLatDistance;

/**
 * @author LiuTao
 * @description:
 * @date : 2020/12/29 8:41
 */
public class Test {

    public static void main(String[] args) {

//        //创建度数变量
//        double alat = 28.165795287154182;
//        double alng = 113.02592210354092;
//        //28.165801645925807===113.02592931642376
//        double al = 28.164795287154182;
//        double bl = 113.02592210354092;
//        double x = al - alat;
//        double y = bl - alng;
//        //移动1米 纬度 0.000006 经度 0.0000007
//        LatLng gpslatLng = MapCalculationLogLatDistance.getBearingLatLng(new LatLng(alat, alng), 1, 45);
//        double distance = MapCalculationLogLatDistance.GetDistanceTwo(alng, alat, bl, al);
//
//        //打印余弦值
//        System.out.println("distance:" + distance);  // 0.5 // 111.31949079369151
//        System.out.println("x--y:" + Math.toDegrees(28.165795287154182));  // 0.5
//
//        System.out.println("x--y:" + x + "===" + y);  // 0.5
//        System.out.println("gpslatLng:" + gpslatLng.latitude + "===" + gpslatLng.longitude);  // 0.5
//        int fov = 84;
//        //高度为100 米 计算
//        //盘向距离
//        float fovShort =getShortEdg(fov);
//        //对地短边距离
//        float fovSpaceShort = getLineSpacesShort(50, fovShort);
//        //主航线的间隔
//        int mLineTwoSpaceWeight = getmLineTWOSpaceWeightByOverPading(80, fovSpaceShort);
//        System.out.println("小红点主航线的间隔:" + mLineTwoSpaceWeight + "==="+fovSpaceShort);  // 0.5
//
//        float fovSpaceLong = getLineSpacesLong(50, fov);
//        //主航线的间隔
//        int mLineTwoSpaceWeightLong = getmLineTopSpaceWeightByOverPading(80, fovSpaceLong);
//        System.out.println("小红点盘向航线的间隔:" + mLineTwoSpaceWeightLong + "==="+fovSpaceLong);  // 0.5
//
//        //lx
//        double routeCourseTrueDistance = getRouteCourseTrueDistance(50, 24, 24);
//        int courseIntervalDistance = (int) (routeCourseTrueDistance - routeCourseTrueDistance * 80 * 0.01);
//        System.out.println("力翔智能主航线的间隔:" + courseIntervalDistance + "===" +routeCourseTrueDistance);  // 0.5
//
//        double routeTrueDistance = getRouteTrueDistance(50, 24, 35);
//        int routeIntervalTrueDistance = (int) (routeTrueDistance - routeTrueDistance * 80 * 0.01);
//        System.out.println("力翔智能盘向航线的间隔:" + routeIntervalTrueDistance + "===" +routeTrueDistance);  // 0.5


    }


    public static double getRouteTrueDistance(double height, double focalLength, double longFormat) {
        focalLength = focalLength / 1000.0;
        longFormat = longFormat / 1000.0;
        return height * longFormat / focalLength;
    }
    /**
     * 航向拍摄真实距离
     *
     * @param height      高度
     * @param focalLength 焦距
     * @param shortFormat 短画幅
     * @param height
     */
    public static double getRouteCourseTrueDistance(double height, double focalLength, double shortFormat) {
        focalLength = focalLength / 1000.0;
        shortFormat = shortFormat / 1000.0;
        return height * shortFormat / focalLength;
    }


    //计算相机在地面短边
    public static float getLineSpacesShort(int relativeHeight, float fovShort) {
        return (int) (2 * relativeHeight * Math.tan(Math.toRadians(fovShort / 2)));
    }

    //计算相机在地面长边
    public static float getLineSpacesLong(int relativeHeight, int fov) {
        return (int) (2 * relativeHeight * Math.tan(Math.toRadians(fov / 2)));

    }


    //更具主航线间重叠率来计算 主航线间间隔距离 假如重叠率为 80%
    public static int getmLineTWOSpaceWeightByOverPading(int masterLineTwoOverc, float fovSpaceShort) {
        return (int) (((1 - masterLineTwoOverc * 0.01) * fovSpaceShort));
    }

    //更具主航线间重叠率来计算 主航上间隔距离 假如重叠率为 80%
    public static int getmLineTopSpaceWeightByOverPading(int masterLineTopOverc, float fovSpaceLong) {
        return (int) (((1 - masterLineTopOverc * 0.01) * fovSpaceLong));
    }

    //计算短边的fov 假如是4：3
    public static float getShortEdg(int fov) {
        int fovShort = (fov * 3) / 4;
        return fovShort;
    }




}

